package com.awesome.designpatterndemo.prototype.prototype2;

import com.awesome.sdk.util.ShowLogUtil;

import java.util.ArrayList;

/**
 * Author: zhangjingfang
 * Email:zhangjingfang@jeejio.com
 * Date: 2021/8/4
 * Description:类描述
 */
public class WorkDocument implements Cloneable{
    private String mText;
    private ArrayList<String> mImages = new ArrayList<>();

    public WorkDocument() {
        ShowLogUtil.info("=====WorkDocument构造======");
    }

    @Override
    protected WorkDocument clone() {
        try {
            WorkDocument doc = (WorkDocument) super.clone();
            doc.mText = this.mText;
            doc.mImages = (ArrayList<String>) this.mImages.clone();
            return doc;
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getText() {
        return mText;
    }

    public void setText(String text) {
        mText = text;
    }

    public ArrayList<String> getImages() {
        return mImages;
    }

    public void addImage(String image) {
        mImages.add(image);
    }

    public void showDocument(){
        ShowLogUtil.info("=====word content start======");
        ShowLogUtil.info("mText = "+mText);
        ShowLogUtil.info("mImages List:");
        for (String imgName : mImages) {
            ShowLogUtil.info("image name ="+imgName);
        }

        ShowLogUtil.info("=====word content end======");

    }
}
 
 